﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Framework;
using SchemaMonitor;

public partial class usercontrols_UCTypeComplex : System.Web.UI.UserControl
{
    public void Display(CType t)
    {
        int num = this.Parent.Controls.Count;
        if (0 != num % 2)
            row.Attributes.Add("class", "alt_row");

        lblName.Text = string.Concat(num, ". ", t.NameOrId);
        //lblSigs.Text = CUtilities.ListToHtml(t.Signatures.Names, "<br/>");
        
        foreach (var i in t.Signatures)
        {
            var l = new Label();
            l.Text = CUtilities.Truncate( i.Name) + "<br>";
            l.ToolTip = i.Name;
            lblSigs.Controls.Add(l);
        }

        //if (t.TypeApiPath.Length > 0)
        //    lblSigs.Text = lblSigs.Text.Replace(t.TypeApiPath, "<b>" + t.TypeApiPath + "<b/>");
        foreach (var tag in t.Tags)
            UCTag(plhTags).Display(tag);
    }


    private static usercontrols_UCTag UCTag(Control target)
    {
        Control ctrl = target.Page.LoadControl("~/usercontrols/UCTag.ascx");
        target.Controls.Add(ctrl);
        return (usercontrols_UCTag)ctrl;
    }
}